#!/usr/bin/python

import rollo.beagle
import shlex, subprocess
import logging
import logging.config

logging.config.fileConfig("conf/userbutton.log.conf")

# create logger
logger = logging.getLogger("main")

def printpressed():
	command_line = 'python rollo.py'
	args = shlex.split(command_line)
	pid = subprocess.Popen(args).pid
	logger.info("Userbutton pressed. Running rollo with pid: {0}".format(pid))

w = rollo.beagle.UserButton()
w.listen(printpressed)
# go on for ever
while (1) :
	pass
